package shoppingmall.jmu.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import shoppingmall.jmu.order.dao.OrderDAO;
import shoppingmall.jmu.order.dao.impl.OrderDAOImpl;
import shoppingmall.jmu.order.entity.Order;


public class Sort_orderSrevlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
    public Sort_orderSrevlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException {
		
		
		request.setCharacterEncoding("utf-8");
		//resp.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset=utf-8");
		String sta = request.getParameter("sta");
		System.out.println(sta);
		
		OrderDAO dao = new OrderDAOImpl();
		List<Order> order = dao.getOrderBySta(sta);
		HttpSession session = request.getSession();
		session.setAttribute("order",order);
		resp.sendRedirect("admin/page/order-sort.jsp");
		
	}

}
